package cn.virens.web.components.beetl.tag.menus;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import cn.virens.web.components.beetl.tag.AbstractTag;

public class MenuTag extends AbstractTag<MenuTag> {
	private @Autowired MenuProvider mMenuProvider;

	@Override
	public void render() {
		String account = String.valueOf(getAttributeValue("account"));
		List<Menu> menus = mMenuProvider.getMenus(account);
		if (menus != null && !menus.isEmpty()) {
			for (Menu menu : menus) {
				this.binds(menu);
				this.doBodyRender();
			}
		} else {
			this.binds("菜单为空!");
			this.doBodyRender();
		}
	}

}
